<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Content-Language" content="UTF-8">
        <script language="javascript" type="text/javascript" src="/pub/share/js/roads.js">
<?php
$link = new Mysqli('192.168.1.108', 'root', '123456', 'test_fscsddt');
$link->query("SET NAMES 'utf8'");
$script = "var ritu = {};";
$script .= "ritu.industries1={";
$result = $link->query("select distinct substring(type, 1, 2) as `id`, `INDUSTRYTYPE1` as `name` from ritu_industry");
while ($row = $result->fetch_assoc()) {
    $script .= "'".$row['id']."':'".$row['name']."',";
};
$script = substr($script, 0, -1)."};";

$script .= "ritu.industries2={";
$result = $link->query("select distinct substring(type, 1, 4) as `id`, `INDUSTRYTYPE2` as `name` from ritu_industry");
while ($row = $result->fetch_assoc()) {
    $script .= "'".$row['id']."':'".$row['name']."',";
};
$script = substr($script, 0, -1)."};";

$script .= "ritu.industries3={";
$result = $link->query("select distinct substring(type, 1, 6) as `id`, `INDUSTRYTYPE3` as `name` from ritu_industry");
while ($row = $result->fetch_assoc()) {
    $script .= "'".$row['id']."':'".$row['name']."',";
};
$script = substr($script, 0, -1)."};";

$script .= "ritu.industries4={";
$result = $link->query("select distinct type as `id`, `INDUSTRYTYPE4` as `name` from ritu_industry");
while ($row = $result->fetch_assoc()) {
    $script .= "'".$row['id']."':'".$row['name']."',";
};
$script = substr($script, 0, -1)."};";

echo $script;
?>
    </script>
    </head>
    <body>
<?php
//$link = new Mysqli('127.0.0.1', 'root', '123456', 'keepdoing');
//$link->query("SET NAMES 'utf8'");
//$script = "var ritu = {};";
//$script .= "ritu.industries1={";
//$result = $link->query("select distinct substring(id, 1, 2) as `id`, `name1` as `name` from ritu_industry");
//while ($row = $result->fetch_assoc()) {
//    $script .= "'".$row['id']."':'".$row['name']."',";
//};
//$script = substr($script, 0, -1)."};";
//
//$script .= "ritu.industries2={";
//$result = $link->query("select distinct substring(id, 1, 4) as `id`, `name2` as `name` from ritu_industry");
//while ($row = $result->fetch_assoc()) {
//    $script .= "'".$row['id']."':'".$row['name']."',";
//};
//$script = substr($script, 0, -1)."};";
//
//$script .= "ritu.industries3={";
//$result = $link->query("select distinct substring(id, 1, 6) as `id`, `name3` as `name` from ritu_industry");
//while ($row = $result->fetch_assoc()) {
//    $script .= "'".$row['id']."':'".$row['name']."',";
//};
//$script = substr($script, 0, -1)."};";
//
//$script .= "ritu.industries4={";
//$result = $link->query("select distinct substring(id, 1, 8) as `id`, `name4` as `name` from ritu_industry");
//while ($row = $result->fetch_assoc()) {
//    $script .= "'".$row['id']."':'".$row['name']."',";
//};
//$script = substr($script, 0, -1)."};";
//
//echo $script;
?>
    </body>
</html>